package model

// LoginRequest Login request params
type LoginRequest struct {
	Email     string `json:"email" binding:"required"`      // User email
	Password  string `json:"password" binding:"required"`   // Password (base64 encoded)
	Captcha   string `json:"captcha" binding:"required"`    // Captcha
	CaptchaId string `json:"captcha_id" binding:"required"` // CaptchaId
	Remember  bool   `json:"remember_me" example:"true"`    // Remember me (optional)
	Service   string `json:"service,omitempty"`             // Service URL for CAS (optional)
}

type LoginResponseData struct {
	Ticket string `json:"ticket"`
}
type LoginResponse struct {
	Response
	Data LoginResponseData `json:"data"`
}

// RegisterRequest Register request params
type RegisterRequest struct {
	Email     string `json:"email" binding:"required"`      // Email
	Captcha   string `json:"captcha" binding:"required"`    // Captcha
	CaptchaId string `json:"captcha_id" binding:"required"` // CaptchaId
}

// ServiceValidateRequest Service验证请求
type ServiceValidateRequest struct {
	Service string `json:"service" binding:"required"` // Service URL
	Ticket  string `json:"ticket" binding:"required"`  // Service Ticket
}

// ServiceValidateResponse Service验证响应
type ServiceValidateResponse struct {
	Response
	Data ServiceValidateResponseData `json:"data"`
}

type ServiceValidateResponseDataUser struct {
	Name   string `json:"name"`
	Email  string `json:"email"`
	Image  string `json:"image"`
	Region string `json:"region"`
	Role   int16  `json:"role"`
}

type ServiceValidateResponseData struct {
	Token  string                          `json:"token"`  // 访问令牌
	Expire int64                           `json:"expire"` // 过期时间
	User   ServiceValidateResponseDataUser `json:"user"`
}

// VerifyRegisterRequest 注册验证请求参数
type VerifyRegisterRequest struct {
	Email     string `json:"email" binding:"required"`      // 邮箱
	Name      string `json:"name" binding:"required"`       // 用户名
	Password  string `json:"password" binding:"required"`   // 密码
	Token     string `json:"token" binding:"required"`      // 验证令牌
	Captcha   string `json:"captcha" binding:"required"`    // 验证码
	CaptchaId string `json:"captcha_id" binding:"required"` // 验证码ID
}

// VerificationData represents the data encoded in base64 for email verification
type VerificationData struct {
	Email string `json:"email"`
	Token string `json:"token"`
}
